package com.yuanchu.order.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuanchu.order.entity.YoshopRegionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * 省市区数据表
 * 
 * @author adan
 * @email 2028038953@gmail.com
 * @date 2023-12-19 20:57:22
 */
@Mapper
public interface YoshopRegionDao extends BaseMapper<YoshopRegionEntity> {
    @Select("SELECT\n" +
            "    t3.name AS region,\n" +
            "    t2.name AS city,\n" +
            "    t1.name AS province\n" +
            "FROM\n" +
            "    yoshop_region t3\n" +
            "        JOIN yoshop_region t2 ON t3.pid = t2.id\n" +
            "        JOIN yoshop_region t1 ON t2.pid = t1.id\n" +
            "WHERE\n" +
            "        t3.id = #{regionId}")
    Map<String, Object> getAddressByOrderId(Integer regionId);
}
